FINERACT-2639: Implement office-hierarchy access checks for monetary transactions#5984
FINERACT-2639: Implement office-hierarchy access checks for monetary transactions#5984EmanuelCR03 wants to merge 1 commit into
Conversation
|
@EmanuelCR03 Please review the failing tests. |
1 similar comment
|
@EmanuelCR03 Please review the failing tests. |
Dpk376
left a comment
There was a problem hiding this comment.
Thanks for tackling this - valuable hardening. I tested the change locally and traced the call graph; coverage of the monetary entry points looks broad and consistent. A few observations:
1. Redundant validateAccessRights in repayLoanWithTopup
fromLoanAccount's hierarchy is validated twice - once right after it is assembled, and again after toLoanAccount is assembled. The first call looks like a copy-paste duplicate and can be removed.
2. Scheduled-job paths depend on the system user being head-office
validateAccessRights calls authenticatedUser(), which throws if there is no user. transferFunds(...) is invoked by ExecuteStandingInstructionsTasklet, TransferInterestToSavingsTasklet, TransferFeeChargeForLoansTasklet, and deposit-maturity processing. These run as the system user (office_id=1, hierarchy "."), so the prefix check passes for every account - but this is an implicit invariant. Could we add a short comment documenting that dependency, and/or a smoke test on one job path so a future change to the system user's office doesn't silently break standing instructions?
3. Primary repayment path - confirmed makeLoanRepayment is covered transitively via makeLoanRepaymentWithChargeRefundChargeType, so standard repayments are protected. 👍
Test suggestion: a negative integration test (user scoped to a child/sibling office attempting a transaction on an account in another branch → expect NoAuthorizationException / 403), plus a positive same-hierarchy case, would lock in the intended behaviour.
Description
FINERACT-2639: Implement office-hierarchy access checks for monetary transactions
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Your assigned reviewer(s) will follow our guidelines for code reviews.